12. dynamic_reconfigure

dynamic_reconfigure

dynamic_reconfigure is a ROS package that allows you to modify node parameters at runtime without having to restart the node. More often than not, it is desirable to modify these parameters manually while running a node, especially for testing or tuning purposes.

We briefly talked about the parameter server in our discussion about Nodes and Topics and explored a simple use case of parameters in our arm_mover code.

Having said that, let’s do a quick recap. A parameter server is a shared dictionary that is used by various ROS nodes to store and retrieve parameters at runtime.

It is inherently slow and hence mostly used for static data such as configuration parameters.

For instance, in the perception pick and place lab, you stored the Pick List in the form of a parameter using the lab launch file and then later retrieved it in your node.

ROS parameters can be of the following data types:

  • Integers (32-bit)
  • Doubles
  • Booleans
  • Strings
  • Lists
  • Dictionaries and a few more

To better understand dynamic_reconfigure, let us dive right into using it with the hover_controller_node.

If you have your quadrotor sim and the hover_controller_node up and running, you are good to go for the next step. Otherwise, please refer the previous section on the Hover Controller before moving forward.

Now fire up a rqt_reconfigure instance, a dynamic_reconfigure based GUI client program, from a new terminal:

$ rosrun rqt_reconfigure rqt_reconfigure

The left panel of the rqt_dynamic_reconfigure GUI lists all active nodes with reconfigurable parameters, hover_controller in this case. Click on the hover_controller to reveal a list of reconfigurable parameters for that node.

Initially, the quadrotor will be on the ground at rest. Set the “target” altitude to 10 (units are meters) and begin tuning the controller by increasing kp until the resultant thrust is strong enough to lift the quadrotor off the ground.

You should tune the PID controller parameters (kp, ki, and kd), until you are happy with the result.

If you would rather not adjust the PID parameters manually, feel free to try out either the Ziegler–Nichols tuning method using hover_zn_tuner_node, or the twiddle tuning algorithm using hover_twiddle_tuner_node. Be sure that you have ran:

$ roslaunch quad_controller hover_controller.launch

before attempting to run the hover_zn_tuner_node or the hover_twiddle_tuner_node.


To run hover_zn_tuner_node type:

$ rosrun quad_controller hover_zn_tuner_node

To run twiddle_tuner_node:

$ rosrun quad_controller hover_twiddle_tuner_node

Write down the parameters you came up with, as you will need them later, for the full positional controller!